import request from '@/utils/request'
import { config } from '@/utils/requestconfig'

export function loadAll(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/LoadData',
    method: 'post',
    data
  })
}

export function add(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/Add',
    method: 'post',
    data: params
  })
}
export function update(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/Update',
    method: 'post',
    data: params
  })
}
export function Delete(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/Delete',
    method: 'post',
    params: { id: params }
  })
}
export function previewPdf(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/PreviewPdf',
    method: 'post',
    params: { type: id }
  })
}
export function loadBySelectBillType(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/LoadMyBillTemple',
    method: 'get',
    params
  })
}
export function getFlowDesign(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowDesign/get',
    method: 'get',
    params: { id: id }
  })
}

export function getFlowInstances(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/get',
    method: 'get',
    params: { id: id }
  })
}

export function saveFlowInstances(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/Add',
    method: 'post',
    data
  })
}
export function customVerifiy(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/CustomVerifiy',
    method: 'post',
    data
  })
}
export function saveFlowInstancesForUpadate(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/Update',
    method: 'post',
    data
  })
}
export function loadFlowInstances(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/Load',
    method: 'get',
    params
  })
}
export function loadAllFlowInstances(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/LoadAll',
    method: 'get',
    params
  })
}
export function loadCcFlowInstances(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/LoadCcFlowInstance',
    method: 'get',
    params
  })
}

// 审批
export function approval(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/Verification',
    method: 'Post',
    data
  })
}
// 打印
export function printBill(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/printBill',
    method: 'Post',
    params: { id: id }
  })
}
// 批量审核
export function batchVerification(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/BatchVerification',
    method: 'Post',
    data: data
  })
}
// /撤回
export function revocation(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/Revocation',
    method: 'Post',
    data: { id: id }
  })
}
// 删除
export function delById(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/DelById',
    method: 'Post',
    data: { id: id }
  })
}
export function getUserTodo() {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/getUserTodo',
    method: 'Post'
  })
}
export function getApprovalLoading() {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/GetApprovalLoading',
    method: 'Post'
  })
}
// 获取一个流程实例的操作历史记录
export function queryHistories(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/QueryHistories',
    method: 'get',
    params: { id: params }
  })
}
// /流传流程
export function getFlowNodes(params) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/GetFlowNodes',
    method: 'get',
    params: { id: params }
  })
}
export function addComment(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/addComment',
    method: 'post',
    data
  })
}
export function sendAudit(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/SendAudit',
    method: 'post',
    data
  })
}
// 催办
export function hastenTask(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/HastenTask',
    method: 'post',
    data
  })
}
export function getComment(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/getComment',
    method: 'get',
    params: { id: id }
  })
}
export function setRead(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/SetRead',
    method: 'Post',
    data: { id: id }
  })
}
export function delComment(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/DelComment',
    method: 'Post',
    data: { id: id }
  })
}
export function backFlow(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/BackFlow',
    method: 'post',
    data
  })
}
export function getNewFlowOperationHistory(id) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/GetNewFlowOperationHistory',
    method: 'Post',
    data: { id: id }
  })
}
// 加签
export function apostille(data) {
  return request({
    baseURL: config.webapi,
    url: '/FlowInstances/Apostille',
    method: 'Post',
    data
  })
}
